package com.wlw.tools;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.TreeSet;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class OrderUuidUtil {
    public static String getOruuid()throws Exception{
        int machineId = 1;
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {
            hashCodeV = -hashCodeV;
        }
      //  SimpleDateFormat format0 = new SimpleDateFormat("yyMMddHHmmss");
        String danzi = "jfid_" + String.format("%5d", hashCodeV);
        return danzi;
    }
    public static String getAppid()throws Exception{
        int machineId = 1;
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {
            hashCodeV = -hashCodeV;
        }
        String danzi = machineId + String.format("%015d", hashCodeV);
        return danzi;
    }

    public static void main(String[]args1) throws Exception{
        int temp = 0;
        // 三重号临时数据
        int ertemp = 0;
        String erString = null;
        String[] arg = "0,1,2,3,4,5,6,7,8,9".split(",");
        String mm=0+","+0+","+1;
        String[] zjhmqs = {"0","0", "1" };
        // 判断三重号是否中奖
        for (int m = 0; m < arg.length; m++) {
            int count = 0;
            Pattern p = Pattern.compile(arg[m]);
            Matcher c = p.matcher(mm);
            while (c.find()) {
                count++;
            }
            if (count == 2) {
                ertemp = 1;
                erString = arg[m];
                break;
            }
        }
        System.out.println(ertemp);
        System.out.println(erString);
        for (int j = 0; j < zjhmqs.length; j++) {
            if (zjhmqs[j].equals(erString)) {
                continue;
                // 如果是三重好的数据不比较，只比较剩下的1个号码
            } else {
                if (arg.toString().contains(zjhmqs[j])) {
                    temp++;
                }
            }

        }
        TreeSet<String> hset = new TreeSet<>((Arrays.asList(zjhmqs)));
        System.out.println(temp);
        System.out.println(hset.size());

    }
}
